//
//  AppConfig.swift
//  QYer
//
//  Created by linhan on 15-4-6.
//  Copyright (c) 2015年 linhan. All rights reserved.
//

import Foundation
import UIKit
private let instance:AppConfig = AppConfig()
class AppConfig: NSObject
{
    private var _navigationBarHeight:CGFloat = 44
    
    private var _tabBarHeight:CGFloat = 49
    
    class var iOS8:Bool{
        var isiOS8:Bool = false
        if #available(iOS 8.0, *){
            isiOS8 = true
        }
        return isiOS8
    }
    
    
    class func shared()->AppConfig
    {
        return instance
    }
    
    //APP的版本
    private var _version:String?
    var version:String
    {
        if let versionString = _version
        {
            return versionString
        }
        if let versionString = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
        {
            _version = versionString
        }
        return _version ?? "0.9"
    }
    
    var statusBarHeight:CGFloat
        {
            return UIApplication.shared.statusBarFrame.height
    }
    
    var navigationBarHeight:CGFloat
        {
        get
        {
            return _navigationBarHeight
        }
        set
        {
            _navigationBarHeight = newValue
        }
    }
    
    var navigationBarBottom:CGFloat
    {
        return statusBarHeight + navigationBarHeight
    }
    
    var tabBarHeight:CGFloat
    {
        get
        {
            return _tabBarHeight
        }
        set
        {
            _tabBarHeight = newValue
        }
    }
    
}
